MODULE GLOBVAR
  !USE NRUTIL, ONLY : ARRAY1D
  IMPLICIT NONE
  
  INTEGER, PARAMETER :: N_ind=707    ! Number of individuals
  INTEGER, PARAMETER :: N_k=10       ! Number of individuals
  INTEGER, PARAMETER :: N_inds=N_ind*N_k   ! Number of simulated individuals
  INTEGER, PARAMETER :: N_test=349   ! Number of test in China REACH curriculum
  !INTEGER, PARAMETER :: N_var=4+2*N_testl   ! Number of parameters
  !INTEGER, PARAMETER :: N_testl=110  ! Number of Language I task
  !INTEGER, PARAMETER :: N_testc=70   ! Number of cognitive II task
  INTEGER, PARAMETER :: N_testf=30   ! Number of Fine Motor II task
  INTEGER, PARAMETER :: N_testg=22   ! Number of Gross Motor task
  !INTEGER, PARAMETER :: N_levell=11  ! Number of Language I level
  !INTEGER, PARAMETER :: N_levelc=13  ! Number of cognitive II level
  INTEGER, PARAMETER :: N_levelf=7   ! Number of Fine Motor II level
  INTEGER, PARAMETER :: N_levelg=9   ! Number of Gross Motor level
  INTEGER, PARAMETER :: N_x_l0=6     ! Number of initial latent skill 
  INTEGER, PARAMETER :: N_x_eta=6    ! Number of learning parameter 
  INTEGER, PARAMETER :: N_l=n_levelf+2        ! Number of cross level 
  INTEGER, PARAMETER :: N_mom=3*N_testf+N_levelf+84+43+79+5*(N_levelf-1)+5*n_levelf     ! number of moments
  INTEGER, PARAMETER :: N_var=n_x_l0+3*N_levelf+n_x_eta-2+2 ! number of parameters
  INTEGER, PARAMETER :: N_boot=200   
  INTEGER, PARAMETER :: N_mom2=855-7
  
  
  !INTEGER, PARAMETER :: N_int=1000     ! Number of estimation
  
  !INTEGER, PARAMETER :: N_test=5
  !INTEGER, PARAMETER :: N_mom=N_testl*(3*N_test-3)+2*(N_testl-1)*N_test+N_testl*(2*N_test-3)
  !INTEGER :: N_type !N_test, N_test_o,n_order,
  !INTEGER,ALLOCATABLE:: N_cut(:)

  !Task 
  INTEGER :: f_test(N_ind, N_testf),g_test(N_ind,N_testg),m_f(N_ind,N_testf),m_g(N_ind,N_testg)
  INTEGER :: levelf(N_testf),levelg(N_testg),indf(N_ind,N_testf),indg(N_ind,N_testg),&
  repf(N_ind,N_testf),repg(N_ind,N_testg),repeatf(N_testf),repeatg(N_testg),&
  monthf(N_testf), timef(N_testf),countnum(N_mom),mmboot(n_boot,n_ind),mmb(n_ind)
  INTEGER :: duf(n_ind,n_levelf)  
  REAL(8) :: ave(n_ind,n_levelf)      
  REAL(8) :: x_testf(N_ind,N_testf,6),x_testg(N_ind,N_testg,6),L0(N_ind,6),firstf(N_ind,2),firstg(N_ind,2),intermean(N_ind)
  REAL(8) :: moment(N_mom),momentboot(n_boot,n_mom),thetaboot(n_boot,n_var)

  ! Variables for MPI
  INTEGER :: myid,numprocs
  
    ! Variance adjustment
  !REAL(8),ALLOCATABLE  :: sigma(:,:)
  
  
  

  
      
  

  
 
  
END MODULE GLOBVAR
